🎯 Задание: Найти 3 самых популярных товара по количеству покупок (не по числу пользователей, а по общему количеству упоминаний).
✅ Ожидаемый результат:
[('banana', 4), ('apple', 4), ('orange', 2)]
💡 Решение:
from collections import Counter
# Собираем все товары в один список all_items = [] for order in orders: all_items.extend(order["items"])
# Считаем количество каждого товара item_counts = Counter(all_items)
# Получаем топ-3 самых популярных top_3 = item_counts.most_common(3)
print(top_3)
📌 Что тренирует задача:
• Работа со словарями и списками • Использование Counter из модуля collections • Умение работать с вложенными структурами • Сортировка по частоте с помощью most_common()
🎯 Задание: Найти 3 самых популярных товара по количеству покупок (не по числу пользователей, а по общему количеству упоминаний).
✅ Ожидаемый результат:
[('banana', 4), ('apple', 4), ('orange', 2)]
💡 Решение:
from collections import Counter
# Собираем все товары в один список all_items = [] for order in orders: all_items.extend(order["items"])
# Считаем количество каждого товара item_counts = Counter(all_items)
# Получаем топ-3 самых популярных top_3 = item_counts.most_common(3)
print(top_3)
📌 Что тренирует задача:
• Работа со словарями и списками • Использование Counter из модуля collections • Умение работать с вложенными структурами • Сортировка по частоте с помощью most_common()
Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”
How to Use Bitcoin?
n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. “They have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. “It’s huge.”